<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Admin\Controller;

class TagController extends AdminController{
    
    public  function Index($url=''){
      $List = M('Tag')->select();
      $this->assign('list',$List);
      $this->display($url);  
    }
    public function add(){
        
      $list = M('Tag');
      $data['title'] = $_POST['title'];
      if(isset($_POST['title']))
      {
          $list->add($data);
          
      }
      $this->Index('Tag/index');
    }
    public function del(){
     $list = M('Tag');
      $data['title'] = $_POST['title'];
       $map = array('title'=>$data['title']);
      if(isset($_POST['title']))
      {  
          $list->where($map)->delete();
           $this->Index('Tag/index');
      }
      else
      {
          echo 'a';
      }
      
     
    }
} 
      